<?
require("config.php");

$location_status .= "| Add";
$show_backnav = "ban_menu";
$menuname = NULL;
$menutarget = NULL;

if (NULL!=$action){

	$product_str='|';
	for ($i=0;$i<count($product);$i++) $product_str.=$product[$i].'|';
	
   $field = array(
	"code", 
	"name", 
	"file",
	"product"
	);


   $content = array(
	$Code,
	$name,
	$Picture_name,
	$product_str
	);

   myInsert($table,$field,$content);

	$dir = "pro_manual/";

	myUpload($Picture,$Picture_name,$dir);


   header("location:" . $rela_path . "share/msg.php?v=68");

   exit();

}else{

  if (checkCode($table,$Code)){

	header("location:" . $rela_path . "share/msg.php?v=9001");

	exit();
  
  }

}

require($rela_path . "inc/header.php");
require($rela_path . "bin/date.php");

$Query="select id,code,name from pro_basic where publish='1' order by id desc;";
$r=myQuery($Query);
$select='';
for ($i=0 ; $i<count($r) ; $i++) {
	$select.='<option value="'.$r[$i][0].'">'.$r[$i][1].'-'.$r[$i][2].'</option>';
}


?>



<form action="" method="post" enctype="multipart/form-data" name="form1">
<input name="action" type="hidden" value="add">
<input name="Code" type="hidden" value="<?print($Code)?>">




<table width="95%" border="0" align="center">
  <tr> 
    <td valign="top"> <table border="0" cellspacing="5" cellpadding="1">
          <tr> 
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr> 
            <td class="tdheader">Code : </td>
            <td><?print($Code)?></td>
          </tr>
          <tr> 
            <td class="tdheader">Name :</td>
            <td><input name="name" type="text" class="text" id="name" size="56"></td>
          </tr>
          <tr> 
            <td class="tdheader">File :</td>
            <td><input type="file" class="text" name="Picture" size="45"> </td>
          </tr>
		  <tr> 
            <td class="tdheader">Products:<br>
            (Allow Mutiple)</td>
            <td><select name="product[]" size="5" multiple>
			<?=$select?>
            </select>              </td>
          </tr>
		  <tr> 
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr> 
            <td>&nbsp;</td>
            <td> <input type="image" src="../../images/bt_cancel.gif" onClick="Redirect('ban_menu.php',1);return false;"> <input type="image" src="../../images/bt_save.gif">
            </td>
          </tr>
          <tr> 
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
        </table>
    </td>

  </tr>
</table>
<br>
<br>
<br>


</form>

<?
require($rela_path . "inc/footer.php");
?>
